package grgu.rud.glava1.b9;

import java.util.Scanner;

public class Sortirovka {

	public static void main(String[] args) {
		Scanner sc = new Scanner((System.in));
		System.out.print("Enter the amount of numbers: ");
		int n = sc.nextInt();
		int[] arr = new int[n];
		System.out.print("Enter the numbers ");
		for (int i = 0; i < arr.length; i++) {
			arr[i] = sc.nextInt();
		}

		for (int i = 0; i < arr.length - 1; i++) {
			for (int j = i + 1; j < arr.length; j++) {
				if (arr[i] > arr[j]) {
					int temp = arr[i];
					arr[i] = arr[j];
					arr[j] = temp;
				}
			}
		}
		System.out.print("The numbers in ascending: ");
		for (int i = 0; i < arr.length; i++) {
			System.out.print(arr[i] + " ");
		}
		System.out.print("\nNumber descending: ");
		for (int i = arr.length - 1; i >= 0; i--) {
			System.out.print(arr[i] + " ");
		}

	}

}
